home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 2010 April / PCWorld0410.iso / hity wydania / Ubuntu 9.10 PL / karmelkowy-koliberek-desktop-9.10-i386-PL.iso / casper / filesystem.squashfs / var / lib / dpkg / info / pcmciautils.preinst < prev    next >
Text File  |  2009-03-09  |  1KB  |  49 lines

  1. #! /bin/sh
  2. set -e
  3.  
  4. # Prepare to remove a no-longer used conffile
  5. prep_rm_conffile()
  6. {
  7.     PKGNAME="$1"
  8.     CONFFILE="$2"
  9.     ACTION="$3"
  10.  
  11.     if [ -e "$CONFFILE" ]; then
  12.         md5sum="`md5sum \"$CONFFILE\" | sed -e \"s/ .*//\"`"
  13.         old_md5sum="`dpkg-query -W -f='${Conffiles}' $PKGNAME | sed -n -e \"\\\\' $CONFFILE'{s/ obsolete$//;s/.* //p}\"`"
  14.         if [ "$md5sum" != "$old_md5sum" ]; then
  15.             if [ "$ACTION" = rename ]; then
  16.                 echo "Obsolete conffile $CONFFILE has been modified by you, renaming to .dpkg-bak"
  17.                 mv -f "$CONFFILE" "$CONFFILE".dpkg-bak
  18.             fi
  19.         else
  20.             if [ "$ACTION" = remove ]; then
  21.                 echo "Removing obsolete conffile $CONFFILE"
  22.                 mv -f "$CONFFILE" "$CONFFILE".moved-by-preinst
  23.             fi
  24.         fi
  25.     fi
  26. }
  27.  
  28. case $1 in
  29.     install|upgrade)
  30.         if [ -z "$2" ] || \
  31.            dpkg --compare-versions "$2" lt 010-0ubuntu5; then
  32.             if [ -f /etc/default/pcmcia ]; then
  33.                 cp -a /etc/default/pcmcia \
  34.                       /etc/default/pcmciautils
  35.             fi
  36.         fi
  37.         if dpkg --compare-versions "$2" lt 010-0ubuntu8; then
  38.             prep_rm_conffile pcmciautils /etc/udev/pcmcia.rules rename
  39.         fi
  40.         if dpkg --compare-versions "$2" lt 014-4ubuntu2; then
  41.             prep_rm_conffile pcmciautils /etc/udev/rules.d/85-pcmcia.rules remove
  42.         fi
  43.         ;;
  44. esac
  45.  
  46.  
  47.  
  48. exit 0
  49.